import java.util.ArrayList;

public class Paladin extends Piece {
	/*
	 * 8   - - - - - - - - - - - -    
	 * 7   -[x x x]- - - - -{x}- -    
	 * 6   -[x[P]x]- - - -{x}-{x}-    
	 * 5   -[x x x]- x - - -{x}- -    
	 * 4   - - - - - - - - - - - -      SKY (3)
	 * 3   - - - x - - - x - - - -    
	 * 2   - - - - - - - - - - - -    
	 * 1   - - - - - x - - - - - -    
	 * 
	 * 8   - -[x]- - - - - -{x}- -    
	 * 7   - - - - - - - - - - - -    
	 * 6  [x]- - -[x]- -{x}- - -{x}   
	 * 5   - - - - x - x - - - - -    
	 * 4   - -[x]x x x x x -{x}- -      EARTH (2)
	 * 3   - - - - x P x - - - - -    
	 * 2   - - - x x x x x - - - -    
	 * 1   - - - - x - x - - - - -    
	 * 
	 * 8   - - - - - - - - - - - -    
	 * 7   - -[x]- - - - -{x x x}-    
	 * 6   -[x]-[x]- - - -{x{P}x}-    
	 * 5   - -[x]- - x - -{x x x}-    
	 * 4   - - - - - - - - - - - -      UNDER (1)
	 * 3   - - - x - - - x - - - -    
	 * 2   - - - - - - - - - - - -    
	 * 1   - - - - - x - - - - - -    
	 * 	   a b c d e f g h i j k l
	 * 
	 * Paladin starts on the EarthBoard. As you can see, its moveset is very complicated. It can
	 * jump over other Pieces, no matter where it's moving to.
	 */
	
	public Paladin(int s) {
		super(s);
	}

	protected ArrayList<Square> getAvailableMoves() {
		moves.clear();
		for(int i = 0; i < 8; i++) {
			moves.add(getSquare().getFarSquare(Square.NORTH + 45 * i, 1));
		}
		if(getSquare().getBoard().getLevel() == 2) {
			for(int i = 0; i < 4; i++) {
				moves.add(getSquare().getFarSquare(Square.NORTHEAST + 90 * i, 1).getFarSquare(Square.NORTHEAST + 90 * i - 45, 1));
				moves.add(getSquare().getFarSquare(Square.NORTHEAST + 90 * i, 1).getFarSquare((Square.NORTHEAST + 90 * i + 45) % 360, 1));
				moves.add(getSquare().getFarSquare(Square.NORTH + 90 * i, 2).getFarSquare(Square.DOWN, 1));
				moves.add(getSquare().getFarSquare(Square.NORTH + 90 * i, 2).getFarSquare(Square.UP, 1));
			}
		} else if(getSquare().getBoard().getLevel() == 1 || getSquare().getBoard().getLevel() == 3) {
			for(int i = 0; i < 4; i++) {
				moves.add(getSquare().getFarSquare(Square.NORTH + 90 * i, 2).getFarSquare(2 - getSquare().getBoard().getLevel(), 1));
				moves.add(getSquare().getFarSquare(Square.NORTH + 90 * i, 1).getFarSquare(2 - getSquare().getBoard().getLevel(), 2));
			}
		}
		System.out.println(moves);
		return moves;
	}
	
	protected ArrayList<Square> getAvailableCapts() {
		return getAvailableMoves();
	}
	
	public String toString() {
		if(side == 1) {
			return "P";
		} else if(side == 2) {
			return "p";
		} else {
			return "no side";
		}
	}
}
